from rest_framework import serializers

from apps.aiauth.models import Users, Role


class AdminRoleSerializer(serializers.ModelSerializer):
    class Meta:
        model = Role
        fields = ('role_id', 'rolename', 'description')


class AdminUsersSerializer(serializers.ModelSerializer):
    role = AdminRoleSerializer()
    gentime = serializers.DateTimeField('%Y-%m-%d %H:%M')

    class Meta:
        model = Users
        fields = ('user_id', 'password', 'studentid', 'username', 'role', 'email', 'phonenumber', 'gentime')
